<?
	   layout("/inc/win_layout.html",{title:sysTitle}){
    ?>
    <link rel="stylesheet" href="static/zTree_v3/css/demo.css" type="text/css"></link>
    <link rel="stylesheet" href="static/zTree_v3/css/zTreeStyle/zTreeStyle.css" type="text/css"></link>
	<script type="text/javascript" src="static/zTree_v3/js/jquery.ztree.core-3.5.js"></script>
<div class="row">
		<div class="col-lg-12">
				<div class="panel" >
					<div class="panel-body pan " style="width:auto;height:380px;overflow: auto;">
						<div id="treeDemo" class="ztree" style="margin-left: 35px;;width:340px;" >
					    </div>
					</div>
				</div>
		</div>
</div>

<?} ?>
<script>
	function getQueryString(name) { 
	var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); 
	var r = window.location.search.substr(1).match(reg); 
	if (r != null) return unescape(r[2]); return null; 
	} 
	var winName=getQueryString("winName");
	var id = getQueryString("id");
	
		var setting = {  
                data: {  
                    simpleData: {  
                        enable: true  
                    }  
                } ,
                async: {
                    enable: true,
                    url:"queryjunoirZTree.do",
                    autoParam:["id", "name", "level"],
                    otherParam:{"otherParam":"zTreeAsyncTest"},
                    dataFilter: filter
                }
        };  
        function filter(treeId, parentNode, childNodes) {
            if (!childNodes) return null;
            for (var i=0, l=childNodes.length; i<l; i++) {
                childNodes[i].name = childNodes[i].name.replace(/\.n/g, '.');
            }
            return childNodes;
        }
        $(document).ready(function(){  
       		$.ajax({
				type : "post",
				url : "queryjunoirZTree.do",
				data : {
					"id" : id,
					"type":0
				},
				dataType : "json",
				success : function(data) {
				//alert(JSON.stringify(data));
				 $.fn.zTree.init($("#treeDemo"), setting, data); 
				},
				error : function(data) {
					alert("请求失败");
				}
			});
        });  
	
</script>


